import {
  Column,
  Entity,
  JoinColumn,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { TestingMachine } from '@/testing-machine/entities/testing-machine.entity';

@Entity()
export class Weather {
  @PrimaryGeneratedColumn()
  id;

  @Column({
    type: 'date',
  })
  weatherDate: Date = new Date();

  @ManyToOne(() => TestingMachine, (test) => test.weather, {
    onDelete: 'CASCADE',
  })
  @JoinColumn()
  testingMachine: TestingMachine;

  @Column({
    type: 'json',
    default: null,
  })
  weatherData: any;
}
